package pm.issue.service;



import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import pm.db.DBUtil;
import pm.issue.bean.IssueBean;
import pm.project.bean.ProjectBean;
import pm.user.bean.UserBean;

public class IssueService {
	
	
	public boolean addOneIssue(IssueBean issue) {
		boolean flag = false;
		Connection conn = DBUtil.getConnection();
		String sql = "insert into pm_issue(issue_name,issue_con,issue_creator,issue_createtime,issue_updatetime,issue_file,issue_state,issue_projectid,issue_type) values("
				+ "'"
				+ issue.getIssueName()
				+ "'"
				+ ","
				+ "'"
				+ issue.getIssueCon()
				+ "'"
				+ ","
				+ "'"
				+ issue.getIssueCreator()
				+ "'"
				+ ","
				+ "'"
				+ issue.getCreateTime()
				+ "'"
				+ ","
				+ "'"
				+ issue.getUpdateTime()
				+ "'"
				+ ","
				+ "'"
				+ issue.getIssueFile()
				+ "'"
				+ ","
				+ "'"
				+ issue.getIssueState()
				+ "'"
				+ ","
				
				
				+ issue.getProjectId()
				
				+ ","
				+ "'"
				+ issue.getIssueType() + "'" + ")";
		PreparedStatement past = null;
		try {
			past = conn.prepareStatement(sql);
			past.executeUpdate();
			past.close();
			conn.close();
			flag = true;
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			DBUtil.close(conn);
		}

		return flag;
	}
	
}
